package com.ruoyi.personnel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.personnel.domain.ResearchBook;
import com.ruoyi.personnel.mapper.ResearchBookMapper;
import com.ruoyi.personnel.service.IResearchBookService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 科研著作Service业务层处理
 *
 * @author ruoyi
 * @date 2021-03-02
 */
@Service
public class ResearchBookServiceImpl extends ServiceImpl<ResearchBookMapper, ResearchBook> implements IResearchBookService {

    @Override
    public List<ResearchBook> queryList(ResearchBook researchBook) {
        LambdaQueryWrapper<ResearchBook> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(researchBook.getChiefEditor())){
            lqw.eq(ResearchBook::getChiefEditor ,researchBook.getChiefEditor());
        }
        if (StringUtils.isNotBlank(researchBook.getChiefNumber())){
            lqw.eq(ResearchBook::getChiefNumber ,researchBook.getChiefNumber());
        }
        if (StringUtils.isNotBlank(researchBook.getChiefPersonnelId())){
            lqw.eq(ResearchBook::getChiefPersonnelId ,researchBook.getChiefPersonnelId());
        }
        if (StringUtils.isNotBlank(researchBook.getCompilerEditor())){
            lqw.eq(ResearchBook::getCompilerEditor ,researchBook.getCompilerEditor());
        }
        if (StringUtils.isNotBlank(researchBook.getCompilerNumber())){
            lqw.eq(ResearchBook::getCompilerNumber ,researchBook.getCompilerNumber());
        }
        if (StringUtils.isNotBlank(researchBook.getCompilerPersonnelId())){
            lqw.eq(ResearchBook::getCompilerPersonnelId ,researchBook.getCompilerPersonnelId());
        }
        if (StringUtils.isNotBlank(researchBook.getBookName())){
            lqw.like(ResearchBook::getBookName ,researchBook.getBookName());
        }
        if (StringUtils.isNotBlank(researchBook.getBookType())){
            lqw.eq(ResearchBook::getBookType ,researchBook.getBookType());
        }
        if (StringUtils.isNotBlank(researchBook.getPublishUnit())){
            lqw.eq(ResearchBook::getPublishUnit ,researchBook.getPublishUnit());
        }
        if (StringUtils.isNotBlank(researchBook.getPublishDate())){
            lqw.eq(ResearchBook::getPublishDate ,researchBook.getPublishDate());
        }
        if (StringUtils.isNotBlank(researchBook.getBookWords())){
            lqw.eq(ResearchBook::getBookWords ,researchBook.getBookWords());
        }
        if (StringUtils.isNotBlank(researchBook.getEnclosure())){
            lqw.eq(ResearchBook::getEnclosure ,researchBook.getEnclosure());
        }
        if (StringUtils.isNotBlank(researchBook.getEnclosureName())){
            lqw.like(ResearchBook::getEnclosureName ,researchBook.getEnclosureName());
        }
        if (StringUtils.isNotBlank(researchBook.getStatus())){
            lqw.eq(ResearchBook::getStatus ,researchBook.getStatus());
        }
        return this.list(lqw);
    }
}
